import { defineStore } from 'pinia';
import { ref, toRaw } from 'vue';
import { http } from '@/utils/http';
import type Valves from "@/types/valves";

// 定义 Store
export const useValvesStore = defineStore(
  'valvesData',
  () => {
    const valvesList = ref<string[]>([])
    const getValvesData = async () => {
      const res = await http<string[]>({
        method: 'GET',  // 使用 get 方法
        url: '/valve/valves',
      });
      valvesList.value = res.data;
      //console.log('just a test');
      //console.log(valvesList.value);
    }


    // 记得 return
    return {
      valvesList,
      getValvesData
    }
  },

)
